package com.joplus.housekeeper.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.hyphenate.chatuidemo.bean.AccompentCityBean;
import com.joplus.housekeeper.R;
import com.joplus.housekeeper.utils.StringUtils;

/**
 * author： ccm
 * time： 2017/6/21.
 * description：
 */

public class AccompentCityAdapter extends BaseAdapter {
    private Context mContext;
    private AccompentCityBean city;
    private final LayoutInflater layout;

    public AccompentCityAdapter(Context context, AccompentCityBean city) {
        layout = LayoutInflater.from(context);
        mContext = context;
        this.city = city;

    }

    @Override
    public int getCount() {
        return city.getData().size();
    }

    @Override
    public Object getItem(int position) {
        return position;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = layout.inflate(R.layout.item_city2check, null);
        TextView tv = (TextView) view.findViewById(R.id.tv_name);
        StringUtils.setText(tv, city.getData().get(position).getName());
        return view;
    }
}
